<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>建材列表</title>
<link rel="stylesheet" href="lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
</head>
<body class="pos-r">
<script th:src="@{/js/vue-2.4.0.js}"></script>
<script th:src="@{/js/vue-resource-1.3.4.js}"></script>
<div id="app">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理 <span class="c-gray en">&gt;</span> 角色管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover ">
				<thead>
					<tr class="text-c">
						<button class="btn" onclick="role_add('添加角色','role-add','800','500')">增加</button>
						<button class="btn" onclick="role_edit('编辑角色','role-edit','800','500')">编辑</button>
					</tr>
					<tr class="text-c">
						<th width="100">名称</th>
						<th width="100">描述</th>
					</tr>
				</thead>
				<tbody>
					<tr class="text-c va-m" v-for="r in role" @click="Show_ru(r.id)">
						<td>{{r.name}}</td>
						<td>{{r.describe}}</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="mt-20" style="margin-top: 100px;">
			<table class="table table-border table-bordered table-bg table-hover table-sort">
				<thead>
					<tr class="text-c">
						<th width="100">用户名</th>
						<th width="100">姓名</th>
						<th width="100">邮箱</th>
						<th width="100">电话</th>
						<th width="100">状态</th>
						<th width="100">部门</th>
					</tr>
				</thead>
				<tbody>
					<tr class="text-c va-m" v-for="itme in rulist">
						<td>{{itme.user.name}}</td>
						<td>{{itme.user.xname}}</td>
						<td>1{{itme.user.id}}7{{itme.user.id+1}}{{itme.user.id+6}}{{itme.user.id+9}}{{itme.user.id+1}}@136.com</td>
						<td>13{{itme.user.id}}}97812381</td>
						<td><span class="label label-success" v-if="itme.user.state==0">
                             <span >正常</span>
                            </span>
							<span class="label label-error" v-if="itme.user.state==1">
								<span >禁用</span>
                             </span>
						</td>
						<td>{{itme.department.name}}</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">


function role_add(title,url,w,h){
	layer_show(title,url,w,h);
}	
function role_edit(title,url,w,h){
    if (vm.rid!=0) {
        var url1="role-edit?id="+vm.rid
        vm.rid=0
        layer_show(title,url1,w,h);
    }else {
        layer.msg("请选择编辑角色!",{icon:7,time:1500})
    }


}	

$('.table-sort').dataTable({
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,1,2,3,4,5]},// 制定列不参与排序
	]
});


var vm=new Vue({
    el:'#app',
    data:{
        rulist:[],
		role:[],
		rid:0
    },
    created() {
        this.Sel_Role()
        this.Show_ru(0)
    },
    methods:{
        Show_ru(id){
            this.rid=id
            this.$http.get("/role_user", {
                params: {
                    id:id
                }
            }).then(function (result) {
               this.rulist=result.data
            })
		},
		Sel_Role(){
            this.$http.get("/Sel_roleAll", {
                params: {
                }
            }).then(function (result) {
                this.role=result.data
            })
		}
    }
})



</script>
</body>
</html>